<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/main.css" />
    <link rel="stylesheet" type="text/css" href="../../css/project.css" />

    <script type="text/javascript" src="../../script/api.js"></script>
    <script type="text/javascript" src="../../script/jquery.js"></script>

    <script type="text/javascript" src="../../script/main.js"></script>
    <script type="text/javascript" src="../../script/bootstrap.js"></script>
</head>
<body>
  <div id="header" class = "send_header">
      <div id="back"></div>
      <h3>我的项目</h3>
  </div>
  <div class = "send_placeholder"></div>
  <div id="all">
      <div class="home" style="padding-top:40px"></div>
  </div>
</body>
<script>
apiready=function(){
  back();
    var NVNavigationBar = api.require('NVNavigationBar');
    var selectIndex = -1;
    var url;
    NVNavigationBar.open({
        rect: {
             x: 0,
             y: 58,
             w: api.frameWidth,
             h: 42
        },
       styles: {
             orientation: 'horizontal',
             bg: '#fff',
             bgAlpha: 1,
             font: {
               size: 14,
               sizeSelected: 14,
               color: '#333',
               colorSelected: '#ff0000',
               alpha: 1
             },
             itemSize: {
                 w: api.frameWidth*0.2,
                 h: 44
             }
       },
        items: [{
           title: '全部',
           bg: '#ffffff',
          //  bgSelected: '#ff00000'
           },{
           title: '待审核',
           bg: '#ffffff'
           },{
           title: '不通过',
           bg: '#ffffff'
           },{
           title: '已通过',
           bg: '#ffffff'
           },{
           title: '已完成',
           bg: '#ffffff'
           }],
           selectedIndex: 0,
           fixedOn: api.frameName,
           id: 'first'
    },function callback(ret1){
      var jwt=$api.getStorage('jwt');
      var NewTemplates='',NewTemplates1='',NewTemplates2='',NewTemplates3='',NewTemplates4='';
      api.ajax({
          url: 'http://47.104.170.122/v1/portal/schoolEnterprise/student/app/positions?token='+jwt+'&pageNum=1&pageSize=100',
          method: 'GET',
          headers: {
            "Access-Control-Allow-Origin": "*",
            "Access-Control-Allow-Headers": "Authorization",
            "Content-Type" : 'application/json; charset=utf-8'
          }
        }, function(ret, err) {
          if(ret.code==0){
              var json=ret.data;
              var btn="";
              var status;
              $.each(json, function(commentIndex, comment){
                if(json[commentIndex].status==null){
                  btn='<button class="btn btn-info">申请</button>';
                  status='申请'
                }
                else if(json[commentIndex].status==0){
                    status='待审核';
                    btn='<button class="btn btn-info send">'+status+'</button>';
                    NewTemplates1=NewTemplates1+'<div class="list"><div class="project_company" status="'+status+'"  positionId="'+json[commentIndex].id+'"><div class="left"><img src="'+json[commentIndex].pictureUrl+'" class="company_logo"/></div><div class="left"><div class="enterpriseName">'+json[commentIndex].enterpriseName+'</div><div class="hot_tags"><span>'+json[commentIndex].introduction+'</span></div></div>'+btn+'</div><div class="project_name"><span>项目名称：</span><span class="projectName">'+json[commentIndex].projectName+'</span><br><span>招募岗位：</span><span class="name">'+json[commentIndex].name+'</span><br><span>招募人数：</span><span class="total">'+json[commentIndex].total+'</span>&nbsp<span>当前人数：</span><span class="currentTotal">'
                    +json[commentIndex].currentTotal+'</span></div></div>';
                  }
                else if(json[commentIndex].status==1){
                  status='不通过';
                  btn='<button class="btn btn-info send">'+status+'</button>';
                  NewTemplates2=NewTemplates2+'<div class="list"><div class="project_company" status="'+status+'"  positionId="'+json[commentIndex].id+'"><div class="left"><img src="'+json[commentIndex].pictureUrl+'" class="company_logo"/></div><div class="left"><div class="enterpriseName">'+json[commentIndex].enterpriseName+'</div><div class="hot_tags"><span>'+json[commentIndex].introduction+'</span></div></div>'+btn+'</div><div class="project_name"><span>项目名称：</span><span class="projectName">'+json[commentIndex].projectName+'</span><br><span>招募岗位：</span><span class="name">'+json[commentIndex].name+'</span><br><span>招募人数：</span><span class="total">'+json[commentIndex].total+'</span>&nbsp<span>当前人数：</span><span class="currentTotal">'
                  +json[commentIndex].currentTotal+'</span></div></div>';
                }
                else if(json[commentIndex].status==2){
                  status='已通过';
                  btn='<button class="btn btn-info send">'+status+'</button>';
                  NewTemplates3=NewTemplates3+'<div class="list"><div class="project_company" status="'+status+'"  positionId="'+json[commentIndex].id+'"><div class="left"><img src="'+json[commentIndex].pictureUrl+'" class="company_logo"/></div><div class="left"><div class="enterpriseName">'+json[commentIndex].enterpriseName+'</div><div class="hot_tags"><span>'+json[commentIndex].introduction+'</span></div></div>'+btn+'</div><div class="project_name"><span>项目名称：</span><span class="projectName">'+json[commentIndex].projectName+'</span><br><span>招募岗位：</span><span class="name">'+json[commentIndex].name+'</span><br><span>招募人数：</span><span class="total">'+json[commentIndex].total+'</span>&nbsp<span>当前人数：</span><span class="currentTotal">'
                  +json[commentIndex].currentTotal+'</span></div></div>';
                }
                else if(json[commentIndex].status==3){
                  status='已完成';
                  btn='<button class="btn btn-info send">'+status+'</button>';
                  NewTemplates4=NewTemplates4+'<div class="list"><div class="project_company" status="'+status+'"  positionId="'+json[commentIndex].id+'"><div class="left"><img src="'+json[commentIndex].pictureUrl+'" class="company_logo"/></div><div class="left"><div class="enterpriseName">'+json[commentIndex].enterpriseName+'</div><div class="hot_tags"><span>'+json[commentIndex].introduction+'</span></div></div>'+btn+'</div><div class="project_name"><span>项目名称：</span><span class="projectName">'+json[commentIndex].projectName+'</span><br><span>招募岗位：</span><span class="name">'+json[commentIndex].name+'</span><br><span>招募人数：</span><span class="total">'+json[commentIndex].total+'</span>&nbsp<span>当前人数：</span><span class="currentTotal">'
                  +json[commentIndex].currentTotal+'</span></div></div>';
                }
                NewTemplates=NewTemplates1+NewTemplates2+NewTemplates3+NewTemplates4;
                $(".home").html(NewTemplates);
             });
             //选择
             if(ret1.index==0){
               $(".home").empty();
               $(".home").append(NewTemplates);
             }else if(ret1.index==1){
               $(".home").empty();
               $(".home").append(NewTemplates1);
             }
             else if(ret1.index==2){
               $(".home").empty();
               $(".home").append(NewTemplates2);
             }
             else if(ret1.index==3){
               $(".home").empty();
               $(".home").append(NewTemplates3);
             }
             else if(ret1.index==4){
               $(".home").empty();
               $(".home").append(NewTemplates4);
             }
          }else{
            toast("项目加载失败","bottom");
          }
        })
    })
  //
  //     //判断用户选中了导航栏的哪一项，如果选择了除全部外的3个选项，为了与后台相对应（导航栏为1对应后台为0的审核中状态）
  //     if(ret.data.status>0){
  //       selectIndex = ret.index-1;
  //       url='/api/projectPosition/technicaluser/isSendCV/list?flag='+selectIndex+'&aid='+aid+'&page=0&size=10';
  //     }
  //     // 如果用户选择全部，则不传aid，展示全部项目信息
  //     else if(ret.index == 0){
  //
  //       url='/api/projectPosition/technicaluser/isSendCV/list?&aid='+aid+'&page=0&size=10';
  //     }
  //
  //     if(selectIndex != -1){
  //       // console.log(selectIndex);
  //       // console.log(url);
  //       $("#all").empty();
  //       // url='/api/projectPosition/technicaluser/isSendCV/list?flag='+selectIndex+'&aid='+aid+'&page=0&size=10';
  //       var functionRet=function(ret){
  //
  //         // console.log("获取数据成功");
  //         // console.log(JSON.stringify(ret.list.length));
  //         for(var i = 0;i<ret.list.length;i++){
  //           var flag  = 0;
  //             if(ret.list[i].flag == 0){//0为审核中，审核状态颜色置为黄色
  //               flag = "审核中";
  //               var templates="<div class='record'>"+
  //               "<div class='record_img'>"+
  //                   "<img src='"+ret.list[i].logo+"' class='company_logo'>"+
  //                 "</div>"+
  //                 "<div class='project_name send_table' isSendCV='"+ret.list[i].isSendCV+"' positionId='"+ret.list[i].positionId+"'><span>"+"项目名称："+ret.list[i].projectName+"</span></div>"+
  //                 "<div class='enterprise_name send_table'><span>"+"公司名称："+ret.list[i].businessName+"<span></div>"+
  //                 "<div class='post send_table'><span>"+"招募岗位："+ret.list[i].positionName+"</span></div>"+
  //                 "<div class='recruit_num send_table'><span>"+"招募人数："+ret.list[i].maxNumber+"</span></div>"+
  //                 "<div class='enrol_num send_table'><span>"+"报名人数："+ret.list[i].nowNumber+"</span></div>"+
  //                 "<div class='recruit_date send_table'><span>"+"招募时间："+formatDate(ret.list[i].createTime,'yyyy-MM-dd')+"</span></div>"+
  //                 "<div class='send_flag send_table send_flag_yellow'><span>"+"审核状态："+flag+"</span></div>"+
  //                 // "<div class='enterprise_name_no'>"+"</div>"+
  //               "</div>";
  //               $("#all").append(templates);
  //             }
  //             else if(ret.list[i].flag == 1){//1为审核通过，审核状态颜色置为绿色
  //               flag = "审核通过";
  //               var templates="<div class='record'>"+
  //               "<div class='record_img'>"+
  //                   "<img src='"+ret.list[i].logo+"' class='company_logo'>"+
  //                 "</div>"+
  //                 "<div class='project_name send_table' isSendCV='"+ret.list[i].isSendCV+"' positionId='"+ret.list[i].positionId+"'><span>"+"项目名称："+ret.list[i].projectName+"</span></div>"+
  //                 "<div class='enterprise_name send_table'><span>"+"公司名称："+ret.list[i].businessName+"<span></div>"+
  //                 "<div class='post send_table'><span>"+"招募岗位："+ret.list[i].positionName+"</span></div>"+
  //                 "<div class='recruit_num send_table'><span>"+"招募人数："+ret.list[i].maxNumber+"</span></div>"+
  //                 "<div class='enrol_num send_table'><span>"+"报名人数："+ret.list[i].nowNumber+"</span></div>"+
  //                 "<div class='recruit_date send_table'><span>"+"招募时间："+formatDate(ret.list[i].createTime,'yyyy-MM-dd')+"</span></div>"+
  //                 "<div class='send_flag send_table send_flag_green'><span>"+"审核状态："+flag+"</span></div>"+
  //                 // "<div class='enterprise_name_no'>"+"</div>"+
  //               "</div>";
  //               $("#all").append(templates);
  //             }
  //             else if(ret.list[i].flag == 2){//2为审核未通过，审核状态颜色置为红色
  //               flag = "审核未通过";
  //               var templates="<div class='record'>"+
  //               "<div class='record_img'>"+
  //                   "<img src='"+ret.list[i].logo+"' class='company_logo'>"+
  //                 "</div>"+
  //                 "<div class='project_name send_table' isSendCV='"+ret.list[i].isSendCV+"' positionId='"+ret.list[i].positionId+"'><span>"+"项目名称："+ret.list[i].projectName+"</span></div>"+
  //                 "<div class='enterprise_name send_table'><span>"+"公司名称："+ret.list[i].businessName+"<span></div>"+
  //                 "<div class='post send_table'><span>"+"招募岗位："+ret.list[i].positionName+"</span></div>"+
  //                 "<div class='recruit_num send_table'><span>"+"招募人数："+ret.list[i].maxNumber+"</span></div>"+
  //                 "<div class='enrol_num send_table'><span>"+"报名人数："+ret.list[i].nowNumber+"</span></div>"+
  //                 "<div class='recruit_date send_table'><span>"+"招募时间："+formatDate(ret.list[i].createTime,'yyyy-MM-dd')+"</span></div>"+
  //                 "<div class='send_flag send_table send_flag_red'><span>"+"审核状态："+flag+"</span></div>"+
  //                 // "<div class='enterprise_name_no'>"+"</div>"+
  //               "</div>";
  //               $("#all").append(templates);
  //             }
  //           }
  //         }
  //         var functionErr=function(err){
  //           toast("投递信息加载失败！","bottom");
  //         }
  //         get(url,functionRet,functionErr);
  //       }
  //       // api.alert({msg:JSON.stringify(selectIndex)});
  //   });
  //   //进入投递页面默认直接展示全部投递信息
  //   url='/api/projectPosition/technicaluser/isSendCV/list?&aid='+aid+'&page=0&size=10';
  //   var functionRet=function(ret){
  //     // var flag  = 0;
  //     // console.log(JSON.stringify(ret));
  //     for(var i = 0;i<ret.list.length;i++){
  //       var flag  = 0;
  //       if(ret.list[i].flag == 0){
  //         flag = "审核中";
  //         var templates="<div class='record'>"+
  //         "<div class='record_img'>"+
  //             "<img src='"+ret.list[i].logo+"' class='company_logo'>"+
  //           "</div>"+
  //           "<div class='project_name send_table' isSendCV='"+ret.list[i].isSendCV+"' positionId='"+ret.list[i].positionId+"'><span>"+"项目名称："+ret.list[i].projectName+"</span></div>"+
  //           "<div class='enterprise_name send_table'><span>"+"公司名称："+ret.list[i].businessName+"<span></div>"+
  //           "<div class='post send_table'><span>"+"招募岗位："+ret.list[i].positionName+"</span></div>"+
  //           "<div class='recruit_num send_table'><span>"+"招募人数："+ret.list[i].maxNumber+"</span></div>"+
  //           "<div class='enrol_num send_table'><span>"+"报名人数："+ret.list[i].nowNumber+"</span></div>"+
  //           "<div class='recruit_date send_table'><span>"+"招募时间："+formatDate(ret.list[i].createTime,'yyyy-MM-dd')+"</span></div>"+
  //           "<div class='send_flag send_table send_flag_yellow'><span>"+"审核状态："+flag+"</span></div>"+
  //           // "<div class='enterprise_name_no'>"+"</div>"+
  //         "</div>";
  //         $("#all").append(templates);
  //       }
  //       else if(ret.list[i].flag == 1){
  //         flag = "审核通过";
  //         var templates="<div class='record'>"+
  //         "<div class='record_img'>"+
  //             "<img src='"+ret.list[i].logo+"' class='company_logo'>"+
  //           "</div>"+
  //           "<div class='project_name send_table' isSendCV='"+ret.list[i].isSendCV+"' positionId='"+ret.list[i].positionId+"'><span>"+"项目名称："+ret.list[i].projectName+"</span></div>"+
  //           "<div class='enterprise_name send_table'><span>"+"公司名称："+ret.list[i].businessName+"<span></div>"+
  //           "<div class='post send_table'><span>"+"招募岗位："+ret.list[i].positionName+"</span></div>"+
  //           "<div class='recruit_num send_table'><span>"+"招募人数："+ret.list[i].maxNumber+"</span></div>"+
  //           "<div class='enrol_num send_table'><span>"+"报名人数："+ret.list[i].nowNumber+"</span></div>"+
  //           "<div class='recruit_date send_table'><span>"+"招募时间："+formatDate(ret.list[i].createTime,'yyyy-MM-dd')+"</span></div>"+
  //           "<div class='send_flag send_table send_flag_green'><span>"+"审核状态："+flag+"</span></div>"+
  //           // "<div class='enterprise_name_no'>"+"</div>"+
  //         "</div>";
  //         $("#all").append(templates);
  //       }
  //       else if(ret.list[i].flag == 2){
  //         flag = "审核未通过";
  //         var templates="<div class='record'>"+
  //         "<div class='record_img'>"+
  //             "<img src='"+ret.list[i].logo+"' class='company_logo'>"+
  //           "</div>"+
  //           "<div class='project_name send_table' isSendCV='"+ret.list[i].isSendCV+"' positionId='"+ret.list[i].positionId+"'><span>"+"项目名称："+ret.list[i].projectName+"</span></div>"+
  //           "<div class='enterprise_name send_table'><span>"+"公司名称："+ret.list[i].businessName+"<span></div>"+
  //           "<div class='post send_table'><span>"+"招募岗位："+ret.list[i].positionName+"</span></div>"+
  //           "<div class='recruit_num send_table'><span>"+"招募人数："+ret.list[i].maxNumber+"</span></div>"+
  //           "<div class='enrol_num send_table'><span>"+"报名人数："+ret.list[i].nowNumber+"</span></div>"+
  //           "<div class='recruit_date send_table'><span>"+"招募时间："+formatDate(ret.list[i].createTime,'yyyy-MM-dd')+"</span></div>"+
  //           "<div class='send_flag send_table send_flag_red'><span>"+"审核状态："+flag+"</span></div>"+
  //           // "<div class='enterprise_name_no'>"+"</div>"+
  //         "</div>";
  //         $("#all").append(templates);
  //       }
  //     // var templates="<div class='record'>"+
  //     // "<div class='record_img'>"+
  //     //     "<img src=''>"+
  //     //   "</div>"+
  //     //   "<div class='project_name'>"+"项目名称："+"</div>"+
  //     //   "<div class='address'>"+"面试地址:"+"</div>"+
  //     //   "<div class='post'>"+"招募岗位："+"</div>"+
  //     //   "<div class='recruit_num'>"+"招募人数："+"</div>"+
  //     //   "<div class='enrol_num'>"+"报名人数："+"</div>"+
  //     //   "<div class='recruit_date'>"+"招募时间："+"</div>"+
  //     //   "<div class='enterprise_name'>"+"企业名称："+"</div>"+
  //     //
  //     // "</div>";
  //     // $("body").append(templates);
  //     // // var templates="<div class='record'>"+
  //     // // "<div class='record_img'><img src=''></div><div class='project_name'>"+"项目名称"+
  //     // // "</div><div class='address'>"+"地址"+"</div><div class='post'>"+"招募岗位"+"</div><div class='recruit_num'>"+"招募人数"+
  //     // // "</div><div class='recruit_date'>"+"招募时间"+"</div><div class='enterprise_name'>"+"企业名称"+
  //     // // "</div><div class='enterprise_words'>"+"企业热词</div></div>";
  //     // // $("body").append(templates);
  //     //
  //     // $(".project_name").text("项目名称："+ret.list[i].projectName);
  //     // $(".post").text("招募岗位："+ret.list[i].positionName);
  //     // // $(".record_img").text(ret.list[0].logo);
  //     // $("img").attr("src",ret.list[i].logo);
  //     // $(".recruit_date").text("招募时间："+ret.list[i].createTime);
  //     // $(".recruit_num").text("招募人数："+ret.list[i].number);
  //     // $(".enrol_num").text("报名人数："+ret.list[i].nowNumber);
  //     // $(".enterprise_name").text(ret.list[i].businessName);
  //   }
  // }
  //   var functionErr=function(err){
  //     toast("投递信息加载失败！","bottom");
  //   }
  //   get(url,functionRet,functionErr);
    //点击项目，打开项目详情页
    //点击项目，打开项目详情页
    $(".home").on("click",".list",function(){
        //var projectId=$(this).find(".project_company").attr("projectId");
        var positionId=$(this).find(".project_company").attr("positionId");
        var status=$(this).find(".project_company").attr("status");
        var logo=$(this).find(".project_company .company_logo").attr("src");
        var enterpriseName=$(this).find(".enterpriseName").html();
        var projectName=$(this).find(".projectName").html();
        var name=$(this).find(".name").html();
        var total=$(this).find(".total").html();
        var currentTotal=$(this).find(".currentTotal").html();
        //打开一个新的页面，并且传递参数
        api.openWin({
            name: 'project_detail',
            url: '../project/project_detail.html',
            pageParam: {
                enterpriseName:enterpriseName,
                projectName:projectName,
                positionId: positionId,
                logo:logo,
                status:status,
                total:total,
                name:name,
                currentTotal:currentTotal
            }
        });
    })
  }
</script>
</html>
